package com.jcl.recruit.resume.service;

import com.jcl.recruit.core.web.utils.RequestUtils;
import com.jcl.recruit.resume.logic.ResumeEduLogic;
import com.jcl.recruit.resume.model.ResumeEdu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author 刘明新
 * @date 2018/8/6 上午11:37
 */
@Service
public class ResumeEduService {

    @Autowired
    private ResumeEduLogic resumeEduLogic;

    public List<Map<String, Object>> selectResumeEudsByResumeId(Integer resumeId) {
        String corpCode = RequestUtils.getCorpCode();
        return resumeEduLogic.findObjListByResumeId(corpCode, resumeId);
    }

    public int insertSelective(ResumeEdu record) {
        return resumeEduLogic.insert(record);
    }

    public int updateByPrimaryKeySelective(ResumeEdu record) {
        return resumeEduLogic.updateByPrimaryKey(record);
    }

    //合并新增删除
    public void insertOrUpdate(ResumeEdu resumeEdu) {
        if (resumeEdu.getId() == null) {
            this.insertSelective(resumeEdu);
        } else {
            this.updateByPrimaryKeySelective(resumeEdu);
        }
    }

    public int isExitResumeEdu(ResumeEdu resumeEdu) {
        return resumeEduLogic.isExitEntity(resumeEdu);
    }

    public int deleteResumeEduById(Integer id) {
        return resumeEduLogic.deleteById(id);
    }
}
